package com.xxm.audio

import android.content.Context
import android.content.res.Resources
import android.content.res.loader.ResourcesProvider
import android.view.LayoutInflater
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.QuickViewHolder
import com.xxm.R

class AudioAdapter(items: List<AudioItem>) : BaseQuickAdapter<AudioItem, QuickViewHolder>(items) {


    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: AudioItem?) {
        holder.setText(R.id.tvName, item?.name ?: "")
        if (true == item?.isSelect) {
            holder.setTextColor(R.id.tvName, context.getColor(R.color.purple_500))
        } else {
            holder.setTextColor(R.id.tvName, context.getColor(R.color.black))
        }
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(
            LayoutInflater.from(context).inflate(R.layout.item_file, parent, false)
        )
    }

}